home *** CD-ROM | disk | FTP | other *** search
- /************************* CDEMO.CPP *********************************
- * *
- * Simple Demo Program for *
- * C M A T H *
- * for Borland C++ *
- * *
- * Copyright 1996-1998 by Martin Sander *
- * *
- * This sample program provides a very basic test *
- * for the correct installation of CMATH. *
- * *
- **************************************************************************/
-
- /* The include-file search path must contain
- \bc\include; \bc\cmath\include;
- The library search path must contain
- \bc\lib; bc\cmath\lib;
- You must build a project with the following entries:
- \bc\cmath\cdemo.cpp
- \bc\cmath\lib\CMATHL3.LIB (DOS),
- or CMATHL3W.LIB (Windows 3.x, EasyWin),
- or CMATHF3W.LIB (Win32, console model)
- (If your Borland C++ directory has a name other than "bc",
- or if you chose to install CMATH into a directory different
- from "bc\cmath", you must use that other name, of course)
- Additionally, you have to link in the standard run-time libraries
- (BC++ 3.x: use Options/Linker/Libraries;
- BC++ 4.x, 5.x: use TargetExpert)
- */
-
- #include <newcplx.h>
- #include <stdio.h>
-
- NEWMATHERR
- int main( void )
- {
- fComplex x, y;
- x = sin( fComplex( 3, 5));
- y = inv( fComplex(0,0)); // will produce an error message
- printf( "x: {%f, %f}\n"
- "y: {%g, %g}\n", x.Re, x.Im, y.Re, y.Im );
- return 0;
- }